﻿@using RXY_Mall.Domain

@{
    //success messages
    var successMessages = new List<string>();
    if (TempData[string.Format("nop.notifications.{0}", NotifyType.Success)] != null)
    {
        successMessages.AddRange(TempData[string.Format("nop.notifications.{0}", NotifyType.Success)] as IList<string>);
    }
    if (ViewData[string.Format("nop.notifications.{0}", NotifyType.Success)] != null)
    {
        successMessages.AddRange(ViewData[string.Format("nop.notifications.{0}", NotifyType.Success)] as IList<string>);
    }


    //error messages
    var errorMessages = new List<string>();
    if (TempData[string.Format("nop.notifications.{0}", NotifyType.Error)] != null)
    {
        errorMessages.AddRange(TempData[string.Format("nop.notifications.{0}", NotifyType.Error)] as IList<string>);
    }
    if (ViewData[string.Format("nop.notifications.{0}", NotifyType.Error)] != null)
    {
        errorMessages.AddRange(ViewData[string.Format("nop.notifications.{0}", NotifyType.Error)] as IList<string>);
    }


    //warning messages
    var warningMessages = new List<string>();
    if (TempData[string.Format("nop.notifications.{0}", NotifyType.Warning)] != null)
    {
        warningMessages.AddRange(TempData[string.Format("nop.notifications.{0}", NotifyType.Warning)] as IList<string>);
    }
    if (ViewData[string.Format("nop.notifications.{0}", NotifyType.Warning)] != null)
    {
        warningMessages.AddRange(ViewData[string.Format("nop.notifications.{0}", NotifyType.Warning)] as IList<string>);
    }
}
@if (successMessages.Count > 0)
{
    <script type="text/javascript">
        $(document).ready(function () {
            var msg = @Html.Raw("'" + successMessages[0]+ "'");
            layer.msg(msg, {
                icon: 1,
                time: 3000
            });
        });
    </script>
}
@if (errorMessages.Count > 0)
{
    <script type="text/javascript">
        $(document).ready(function () {
            var msg = @Html.Raw("'" + errorMessages[0]+ "'");
            layer.msg(msg, {
                icon: 2,
                time: 3000
            });

        });
    </script>
}
@if (warningMessages.Count > 0)
{
    <script type="text/javascript">
        $(document).ready(function () {
            var msg = @Html.Raw("'" + warningMessages[0]+ "'");
            layer.msg(msg, {
                icon: 3,
                time: 3000
            });
        });
    </script>
}


